<form action="<?php echo U('Admin/Goods/Category/create')?>" id="create-special">
    <div class="col-xs-12 col-md-12 col-lg-12 padding-none lists">
        <div class="col-lg-2 col-md-3 col-xs-5 filed-name text-right">标题<pub>*</pub> :</div>
        <div class="col-lg-3 col-md-5 col-xs-7 filed-from padding-none">
            <input name="title" type="text" autocomplete="off" class="form-control radius-none _data" >
        </div>
    </div>
    <div class="col-xs-12 col-md-12 col-lg-12 padding-none lists">
        <div class="col-lg-2 col-md-3 col-xs-5 filed-name text-right">描述<pub>*</pub> :</div>
        <div class="col-lg-3 col-md-5 col-xs-7 filed-from padding-none">
            <textarea name="description" class="form-control radius-none _data"></textarea>
        </div>
    </div>
    <div class="col-xs-12 col-md-12 col-lg-12 padding-none lists">
        <div class="col-lg-2 col-md-3 col-xs-5 filed-name text-right">缩略图<pub>*</pub> :</div>
        <div class="col-md-7 filed-from padding-none">
            <img class="thumb _thumb" data-toggle="tooltip" data-placement="top" title="允许上传 jpg , png " src="/statics/common/images/image.png" width="150" height="100">
            <input type="hidden" name="thumb" data-field="thumb" class="_data" />
        </div>
    </div>
    <div class="col-xs-12 col-md-12 col-lg-12 padding-none lists">
        <div class="col-lg-2 col-md-3 col-xs-5 filed-name text-right">专题详情<pub>*</pub> :</div>
        <div class="pull-left filed-from padding-none" style="width: 350px;">
            <script id="content"></script>
        </div>
    </div>
    <div class="col-xs-12 col-md-12 col-lg-12 lists text-right">
        <input type="submit" name="dosubmit" value="保存" class="btn btn-success radius-none">
        <input type="reset"  value="重置" class="btn btn-info radius-none">
    </div>
</form>
<script>


    $(function(){

        var ueditor;
        //加载百度编辑器
        Admin.getUeditor('content',function(ue){

            ueditor = ue;

        });

        $('#create-special').submit(function(){

            var data = {};

            $('._data').each(function(){

                var _this = $(this);

                data[_this.attr('name')] = _this.val();

            });

            data['content'] = ueditor.getContent();

            if (!data.title) {

                layer.msg('标题不能为空!',{offset:50,shift:6});
                return false;

            }

            if (!data.description) {

                layer.msg('描述不能为空!',{offset:50,shift:6});
                return false;

            }

            if (!data.content) {

                layer.msg('内容不能为空!',{offset:50,shift:6});
                return false;

            }


            if (!data.thumb) {

                layer.msg('请上传缩略图!',{offset:50,shift:6});
                return false;

            }

            $.post("<?php echo U('Admin/Special/Index/create')?>",{'data':data},function(result){

                showMessage(result.msg,result.code,'','',2000);

            })

            return false;

        });

        //加载上传组建
        Admin.upload('._thumb');

    })
    //图片上传回调
    function getImageSrc(_this){

        $('img._thumb').attr('src',cutUrl(_this[0],150,100));

        $('input[name="thumb"]').val(_this[0]);

    }

</script>